Skip to content

London | 26-ITP-May | Remi M. | Sprint 1 | Coursework Sprint 1#1322

Open
remimarcelle wants to merge 12 commits into
CodeYourFuture:mainfrom
remimarcelle:coursework/sprint-1
Open

London | 26-ITP-May | Remi M. | Sprint 1 | Coursework Sprint 1#1322
remimarcelle wants to merge 12 commits into
CodeYourFuture:mainfrom
remimarcelle:coursework/sprint-1

Conversation

@remimarcelle
Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Completed all coursework for sprint 1

@remimarcelle
Copy link
Copy Markdown
Author

Linked to issue: remimarcelle/My-Coursework-Planner#58

@remimarcelle remimarcelle added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Structuring-And-Testing-Data The name of the module. labels May 19, 2026
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codes look good. No change needed.

I just have a few questions to test your understanding. You can just respond directly in the inline comments.

Comment on lines +8 to +13
// Line 3 is updating the value of the count variable. The = operator is an
// assignment operator, which assigns the value on the right side
// (count + 1) to the variable on the left side (count). In this case,
// it takes the current value of count (which is 0), adds 1 to it, and then
// assigns the result (1) back to count. So after line 3 executes, count will
// have a new value of 1. No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Operation like count = count + 1 is very common in programming, and there is a programming term describing such operation.

Can you find out what one-word programming term describes the operation on line 3?

Comment on lines +13 to +15
// Math.floor()= rounds a number down to the nearest integer
// Math.random() = generates a random float number between 0 and 1 (not including 1)
// Math.random() * 100 = generates a random float number between 0 and 99.999...
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: To describe a range of numbers, we can use the concise and precise interval notation:

  • [, ] => inclusion
  • (, ) => exclusion

For example, [1, 10) means, all numbers between 1 and 10, including 1 but excluding 10.

// Line 10: console.log()

// b) Run the code and identify the line where the error is coming from - why is this error occurring? How can you fix this problem?
// Line 5 has a SyntaxError - there is a missing comma between "," and "" in replaceAll(","" should be replaceAll(",", "")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the function call .replaceAll(",", ""), there's a programming term for "," and "" (the values passed into the function). Could you find out what it's called?

// 2. penceString.substring(0, penceString.length - 1): removes the trailing "p" by taking all characters except the last one -> "399"
// 3. paddedPenceNumberString = "399".padStart(3, "0"): ensures the string is at least 3 characters long, padding with "0" on the left if needed. "399" stays "399" but "5p" would become "005"
// 4. pounds = paddedPenceNumberString.substring(0, length - 2): takes everything except the last 2 digits, giving the pounds part -> "3"
// 5. pence = paddedPenceNumberString.substring(length - 2).padEnd(2, "0"): takes the last 2 digits for the pence -> "99". padEnd ensures it stays 2 digits e.g. "5" would become "50"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we expect this program to work as intended for any valid penceString if we deleted .padEnd(2, "0") from the code?
In other words, do we really need .padEnd(2, "0") in this script?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Structuring-And-Testing-Data The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants